package com.zhangfb95.crosschain.server.infra.config.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author zhangfubing
 * @since 2023/12/14
 */
@Configuration
public class RpcAuthConfiguration implements WebMvcConfigurer {

    @Autowired
    private RpcAuthInterceptor rpcAuthInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(rpcAuthInterceptor)
                .addPathPatterns("/rpc/chain/**")
                .addPathPatterns("/rpc/user/updateUsername")
                .addPathPatterns("/rpc/user/updatePassword")
                .addPathPatterns("/rpc/user/updateSecret");
    }
}
